perm filename BUZZ.SAI[KBD,ROB]1 blob
sn#448055 filedate 1979-06-08 generic text, type C, neo UTF8
COMMENT ⊗ VALID 00007 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 begin "BUZZ"
C00005 00003 α requires and external definitions
C00007 00004 α declarations
C00008 00005 α local procedures
C00012 00006 α the Program
C00014 00007 α the end
C00015 ENDMK
C⊗;
begin "BUZZ"
comment
This program is for buzzing wire-wrap boards, using .WLZ files from
the SUDS drawing program. The program will prompt for a filename, and
expect a .WLZ format file. Each connection that needs buzzing will be
printed out, one at a time, waiting for any character from the
keyboard. The way I intend this program to be used is that a wire
which fakes a keyboard strobe be used to test the continuity of each
circuit. When the circuit is completed, the program gets some random
character (probably a null or a 377). Then the next line to be buzzed
will be printed out. This is the kind of hack that TVR would really
love...even if the program IS written in SAIL.
;
REQUIRE "{}<>" DELIMITERS;
DEFINE SP={" "},
CR={('15&"")},
LF={('12&"")},
↓={('15&'12)},
TAB={('11&"")},
FF={('14&"")},
QT={""""},
ALT={('175&"")},
VT={('13&"")},
BS={('177&"")};
DEFINE α = {COMMENT},
⊂ = {BEGIN},
⊃ = {END};
DEFINE $DBUG = TRUE;
DEFINE DBUGPRINT(str) = {IF $DBUG THEN PRINT(str)};
DEFINE THROUGH = {STEP 1 UNTIL};
DEFINE DOWNTO = {STEP -1 UNTIL};
DEFINE DOWN = {STEP -1 UNTIL 0};
DEFINE PI = {3.14159265358979};
DEFINE InDev = {"DSK"};
DEFINE AsciiMode = {('0)};
DEFINE ImageMode = {('10)};
DEFINE NIBuffs = {('20)};
DEFINE NOBuffs = {('00)};
DEFINE EndOfFile = {('177)};
DEFINE PageMark = {('14)};
DEFINE NewLine = {('12)};
α requires and external definitions;
require "IO.REL[LIB,KS]" load_module;
external integer COLONTBL,FFLFTBL,SPTABTBL,TOKENTBL;
external record_class $FILE(
string DEVICE,NAME;
integer SIXNAME,SIXEXTEN,SIXPPN;
integer CHANNEL,MODE,IBUF,OBUF,COUNT,BRCHAR,EOF;
integer LINNUM,PAGNUM,SOSNUM;
integer array INFO);
external record_pointer($FILE) procedure GETFILE(
string PROMPT;
integer MODE,I,O;
string DEFDEV,DEFNAME);
external procedure SkipE(
record_pointer($FILE) InStream;
reference string BufChars);
external integer procedure NextChar(
record_pointer($FILE) InStream;
reference string BufChars);
α declarations;
record_pointer($FILE) INFILE, TTYFILE;
string LINE, CHAR;
integer OurKbd,LastState;
α local procedures;
procedure Next_Page(
record_pointer($FILE) InStream;
reference string BufChars);
⊂ "Skip to next page"
do BufChars ← input($FILE:CHANNEL[InStream],FFLFTBL)
until ($FILE:EOF[InStream]) OR ($FILE:BRCHAR[InStream] = FF);
⊃ "Skip to next page";
integer procedure Next_Line(
record_pointer($FILE) InStream;
reference string BufChars);
⊂ "Skip to next line"
if ¬($FILE:EOF[InStream])
then BufChars ← input($FILE:CHANNEL[InStream],FFLFTBL);
⊃ "Skip to next line";
integer procedure Print_Line(
record_pointer($FILE) InStream;
reference string BufChars);
⊂ "Print next line"
if ¬($FILE:EOF[InStream])
then
⊂
PRINT(BufChars);
BufChars ← input($FILE:CHANNEL[InStream],FFLFTBL);
⊃;
⊃ "Print next line";
integer procedure GetKbd;
⊂ "Get True KBD Number"
DEFINE TTYSET(n) = {CALLI n,'400121};
integer TTSCMD;
TTSCMD ← '17000000001; α TTYSET opcode '17, store answer in ac 1;
start_code
HRROI 2,TTSCMD ; α -word count,,address of list of TTYSET cmmnds;
TTYSET(2) ; α get KBD # of KBD controlling this job;
end;
⊃ "Get True KBD Number";
integer procedure Fetch_KBStrobe(
integer KBNumber;
reference integer Lastate);
⊂ "Fetch any KBD Strobe"
define SLEEP(n) = {CALLI n,'31};
define TTREAD(n) = {'051700000000 + n};
label LOOP1, LOOPEN;
start_code
JRST LOOPEN ; α Jump into the loop;
LOOP1: MOVEI 2,1 ; α sleep for a moment;
SLEEP(2) ;
LOOPEN: MOVE 1,KBNumber ;
TTREAD(1) ; α Do a TTREAD on that line;
ANDI 1,'011777 ; α Mask out a couple of spurious bits;
CAMN 1,Lastate ; α Has the keyboard changed?;
JRST LOOP1 ; α Nope - go sleep for a moment before checking;
MOVEM 1,Lastate ; α Yep - save the state for the next time;
end;
⊃ "Fetch any KBD Strobe";
α the Program;
INFILE ← GETFILE("Input WLZ File: ",AsciiMode,20,20,"DSK",".WLZ");
SkipE(INFILE, LINE); α Skip E directory (if present);
OurKbd ← GetKbd; α Find out our KBD number;
Next_Page(INFILE,LINE);
while ¬$FILE:EOF[INFILE] do
⊂ "Read the file"
if $FILE:BRCHAR[INFILE] = FF
then
⊂ "Here's a new page"
print("(page ",$FILE:PAGNUM[INFILE],")",↓);
Next_Line(INFILE,LINE);
Next_Line(INFILE,LINE);
Print_Line(INFILE,LINE); α Print the Z level banner;
print(↓);
Next_Line(INFILE,LINE);
Next_Line(INFILE,LINE);
Next_Line(INFILE,LINE);
⊃ "Here's a new page"
else
⊂
Next_Line(INFILE,LINE);
⊃;
Print_Line(INFILE,LINE);
α Fetch_KBStrobe(OurKbd,LastState);
INCHRW;
outstr(" OK"&↓);
⊃ "Read the file";
α the end;
end "BUZZ";